<?php
/**
 * Prado Portal.
 *
 * @author Steen Rabol <steen.rabol@gmail.com>
 * @link http://www.pradoportal.dk/
 * @copyright Copyright &copy; 2006,2007,2008 Steen Rabol
 * @license http://www.pradoportal.dk
 * @version $Id: PortalDropDownList.php 447 2011-01-05 13:16:31Z steen.rabol $
 *
 */
Prado::using('System.Web.UI.WebControls.TDropDownList');
class PortalDropDownList extends TDropDownList
{

	// This is a copy of the original method from TListControl,
	// with the exception that this one does NOT throw an exception
	// in case of a wrong value
	public function setSelectedValue($value)
    {
	    if($this->Items)
	    {
		    if($value===null)
		    	$this->clearSelection();
		    else if(($item = $this->Items->findItemByValue($value))!==null)
	    	{
		    	$this->clearSelection();
		    	$item->setSelected(true);
	    	}
	    	else
	    	{
	    		//throw new TInvalidDataValueException('listcontrol_selectedvalue_invalid',get_class($this),$value);
	    		$this->clearSelection();
	    	}
    	}
    	//$this->_cachedSelectedValue=$value;
		if($this->getAdapter() instanceof IListControlAdapter)
			$this->getAdapter()->setSelectedValue($value);
    }
}
?>